-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scala 2.12 upgrade preview with mysql tests fixed #346
Conversation
1. Incremented all required versions to value that included scala 2.12 support. See diff for details. 2. Modified RedisStore to use Buf instead of ChannelBuffer due to changes in underlying client. To ease this transition a method to convert Store[Buf, Buf] to Store[ChannelBuffer, ChannelBuffer] is provided on RedisStore. 3. Removed support for Scala 2.10. Two libraries lacked support for scala 2.10 and 2.12 on the same version: twiiter-util and finagle. Supporting 2.10 finagle and 2.12 finagle was not possible due to interface changes. 4. Various packages changed and were fixed. 5. Added target to travis.yml and build.sbt to include scala 2.12. 6. Set source and build target to java 8 to support scala 2.12.
All tests have passed afaict, looks like travis is having issues. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall, the only questionable thing for me - should we enable 2.12 as part of this change?
.travis.yml
Outdated
- scala: 2.11.8 | ||
jdk: oraclejdk8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we do this for 2.11?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I guess in the original PR Ben may have added it for consistency. Let me remove it.
build.sbt
Outdated
crossScalaVersions := Seq("2.10.6", "2.11.7"), | ||
javacOptions ++= Seq("-source", "1.6", "-target", "1.6"), | ||
javacOptions in doc := Seq("-source", "1.6"), | ||
crossScalaVersions := Seq("2.11.7", "2.12.1"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we add 2.12 here then should we also enable travis for 2.12?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use 2.11.11
and 2.12.2
?
@@ -19,7 +19,8 @@ package com.twitter.storehaus.algebra.query | |||
import org.scalacheck.{ Gen, Arbitrary } | |||
import org.scalacheck.Prop._ | |||
import org.scalacheck.Properties | |||
import com.twitter.scalding._ | |||
import com.twitter.scalding.{RichDate, DateRange, Duration, AbsoluteDuration, Years, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need it in this review?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to minimize. I prefer to keep the diffs as minimal as possible (and personally never mix style and logic changes if possible).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
.travis.yml
Outdated
script: umask 0022 && ./sbt ++$TRAVIS_SCALA_VERSION clean coverage test coverageReport mimaReportBinaryIssues | ||
after_success: | ||
- bash <(curl -s https://codecov.io/bash) | ||
# - scala: 2.12.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the story here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh... this got carried over from Ben's original PR. Let me uncomment this.
build.sbt
Outdated
crossScalaVersions := Seq("2.10.6", "2.11.7"), | ||
javacOptions ++= Seq("-source", "1.6", "-target", "1.6"), | ||
javacOptions in doc := Seq("-source", "1.6"), | ||
crossScalaVersions := Seq("2.11.7", "2.12.1"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use 2.11.11
and 2.12.2
?
@@ -19,7 +19,8 @@ package com.twitter.storehaus.algebra.query | |||
import org.scalacheck.{ Gen, Arbitrary } | |||
import org.scalacheck.Prop._ | |||
import org.scalacheck.Properties | |||
import com.twitter.scalding._ | |||
import com.twitter.scalding.{RichDate, DateRange, Duration, AbsoluteDuration, Years, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to minimize. I prefer to keep the diffs as minimal as possible (and personally never mix style and logic changes if possible).
@@ -70,7 +70,6 @@ object MemcacheStore { | |||
.tcpConnectTimeout(timeout) | |||
.requestTimeout(timeout) | |||
.connectTimeout(timeout) | |||
.readerIdleTimeout(timeout) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems like a maybe logical change. Are we sure there is nothing to replace it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Applied the alternative way of doing this.
kv match { | ||
case (k, Some(v)) => | ||
client.del(Seq(k)) // put, not merge, semantics | ||
ttl.map(exp => client.expire(k, exp.inSeconds)) | ||
client.dels(Seq(k)) // put, not merge, semantics |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't need to wrap with a Seq
. Could we just call client.del(k)
maybe? Also, this seems like a a race to me. the del could happen after the set. We should use flatMap to sequence:
for {
_ <- client.del(k)
_ <- ttl.fold(Future.Unit) { exp => client.expire(k, exp.inSeconds) }
_ <- set(k, v.toList)
} yield ()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
del is deprecated unfortunately. Taken care of the race.
set(k, v.toList) | ||
case (k, None) => | ||
client.del(Seq(k)).unit | ||
client.dels(Seq(k)).unit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there noclient.del(k)
we can call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
del is deprecated:
@deprecated("remove netty3 types from public API", "2016-03-24")
def del(keys: Seq[ChannelBuffer]): Future[JLong] =
override def get(k: ChannelBuffer): Future[Option[Seq[(ChannelBuffer, Double)]]] = | ||
client.zRange(k, 0, -1, true).map( | ||
override def get(k: Buf): Future[Option[Seq[(Buf, Double)]]] = | ||
client.zRange(k, 0.toLong, -1.toLong, true).map( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0L
and -1L
is the better way to do this.
kv match { | ||
case (set, Some(scorings)) => | ||
client.del(Seq(set)).flatMap { _ => | ||
client.dels(Seq(set)).flatMap { _ => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there no client.del(set)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is but it's marked deprecated.
Future.collect(members.multiPut(scorings.map { | ||
case (member, score) => ((set, member), Some(score)) | ||
}.toMap).values.toSeq).unit | ||
} | ||
case (set, None) => | ||
client.del(Seq(set)).unit | ||
client.dels(Seq(set)).unit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comment about client.del(set)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
del is deprecated.
} | ||
} | ||
|
||
object ChannelBuffer2BufInjection extends Injection[ChannelBuffer, Buf] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be a bijection, not an Injection (there is an implicit from Bijection to Injection, by the way so you can pass this as the injection above).
finagle-http-compat has been removed in more recent versions, taking care of that may need non-trivial changes. Will upgrade finagle version in a follow up change.
…, again due to property declaration behavior change in scalacheck. Fix that.
Codecov Report
@@ Coverage Diff @@
## develop #346 +/- ##
===========================================
- Coverage 61.48% 61.33% -0.15%
===========================================
Files 119 119
Lines 1807 1813 +6
Branches 118 117 -1
===========================================
+ Hits 1111 1112 +1
- Misses 696 701 +5
Continue to review full report at Codecov.
|
+1 After we publish a new version, we should bump the minor version, and remove all the exclusions for mima. Thanks for doing this. |
Builds on top of #342 fixing the mysql tests that the scalacheck upgrade breaks.